#pragma once

#include <gofcl_usbfs_r.h>

typedef enum {
	USBFS_FIFO0_R = 0x1000,
	USBFS_FIFO1_R = 0x2000,
	USBFS_FIFO2_R = 0x3000,
	USBFS_FIFO3_R = 0x4000,
	USBFS_FIFO4_R = 0x5000,
	USBFS_FIFO5_R = 0x6000,
	USBFS_FIFO6_R = 0x7000,
	USBFS_FIFO7_R = 0x8000,
} usbfs_fifo_re;

static inline u32_s usbfs_get_fifo_q(usbfs_fifo_re fifo_r) {
	return USBFS_Q + (u32_s)fifo_r;
}

static inline void usbfs_wreg_fifo(usbfs_fifo_re fifo_r, u32_s value) {
	u32_s fifo_q = usbfs_get_fifo_q(fifo_r);
	wreg(fifo_q, value);
}

static inline u32_s usbfs_rreg_fifo(usbfs_fifo_re fifo_r) {
	u32_s fifo_q = usbfs_get_fifo_q(fifo_r);
	return rreg(fifo_q);
}
